package com.stations.controller;

import com.stations.common.aop.annotation.Log;
import com.stations.common.aop.annotation.Repeat;
import com.stations.common.aop.enums.BusinessType;
import com.stations.common.cache.impl.DictionaryCache;
import com.stations.common.constant.ControllerConstant;
import com.stations.common.web.base.BaseController;
import com.stations.common.web.domain.response.Result;
import com.stations.domain.SysDictData;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * Describe: 公共获取
 * Author: Ljy
 * CreateTime: 2019/10/23
 */
@RestController
@Api(tags = {"公共获取"})
@RequestMapping(ControllerConstant.API_SYSTEM_PREFIX + "commons")
public class SysCommonsController extends BaseController {

    @Resource
    DictionaryCache dictionaryCache;

    @Repeat
    @GetMapping("getDictionaryMap")
    @ApiOperation(value = "获取字典表")
    @Log(title = "获取字典表", describe = "获取字典表", type = BusinessType.QUERY)
    public Result getDictionaryMap() {
        Map<String, List<SysDictData>> load = dictionaryCache.load();
        return success("保存成功",load);
    }

}
